package Fixtures::Deliveryservice;

#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
use Moose;
extends 'DBIx::Class::EasyFixture';
use namespace::autoclean;

my %definition_for = (
	ds_cdn1 => {
	new   => 'Deliveryservice',
		using => {
			id                    => 100,
			xml_id                => 'test-ds1',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,
			long_desc             => 'test-ds1 long_desc',
			long_desc_1           => 'test-ds1 long_desc_1',
			long_desc_2           => 'test-ds1 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds1.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'test-ds1-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			logs_enabled          => 1,
			anonymous_blocking_enabled => 1,
		},
	},
	ds_cdn2 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 200,
			xml_id                => 'test-ds2',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'test-ds2 long_desc',
			long_desc_1           => 'test-ds2 long_desc_1',
			long_desc_2           => 'test-ds2 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds2.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 9,
			profile               => 100,
			cdn_id                => 100,
			display_name          => 'test-ds2-displayname',
			initial_dispersion    => 1,
			geo_provider          => 0,
			regional_geo_blocking => 0,
			ipv6_routing_enabled  => 0,
			logs_enabled          => 0,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_cdn3 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 300,
			xml_id                => 'test-ds3',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'test-ds3 long_desc',
			long_desc_1           => 'test-ds3 long_desc_1',
			long_desc_2           => 'test-ds3 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds3.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 9,
			profile               => 100,
			cdn_id                => 100,
			display_name          => 'test-ds3-displayname',
			initial_dispersion    => 1,
			geo_provider          => 0,
			regional_geo_blocking => 0,
			ipv6_routing_enabled  => 0,
			logs_enabled          => 0,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_cdn4 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 400,
			xml_id                => 'test-ds4',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'test-ds4 long_desc',
			long_desc_1           => 'test-ds4 long_desc_1',
			long_desc_2           => 'test-ds4 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds4.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 9,
			profile               => 100,
			cdn_id                => 100,
			display_name          => 'test-ds4-displayname',
			initial_dispersion    => 1,
			geo_provider          => 0,
			regional_geo_blocking => 0,
			ipv6_routing_enabled  => 0,
			logs_enabled          => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_dns => {
		new   => 'Deliveryservice',
		using => {
			id                    => 500,
			xml_id                => 'test-ds5',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'test-ds5 long_desc',
			long_desc_1           => 'test-ds5 long_desc_1',
			long_desc_2           => 'test-ds5 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds5.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 7,
			profile               => 300,
			cdn_id                => 100,
			display_name          => 'test-ds5-displayname',
			initial_dispersion    => 1,
			geo_provider          => 0,
			regional_geo_blocking => 0,
			ipv6_routing_enabled  => 0,
			logs_enabled          => 0,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_http_no_cache => {
		new   => 'Deliveryservice',
		using => {
			id                    => 600,
			xml_id                => 'test-ds6',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 10,			
			long_desc             => 'test-ds6 long_desc',
			long_desc_1           => 'test-ds6 long_desc_1',
			long_desc_2           => 'test-ds6 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds6.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 9,
			profile               => 300,
			cdn_id                => 100,
			display_name          => 'test-ds6-displayname',
			initial_dispersion    => 1,
			geo_provider          => 0,
			regional_geo_blocking => 0,
			ipv6_routing_enabled  => 0,
			logs_enabled          => 0,
			anonymous_blocking_enabled => 0,
		},
	},
	steering_ds1 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 700,
			xml_id                => 'steering-ds1',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 5,			
			long_desc             => 'steering-ds1 long_desc',
			long_desc_1           => 'steering-ds1 long_desc_1',
			long_desc_2           => 'steering-ds1 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://steering-ds1.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'steering-ds1-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	steering_ds2 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 800,
			xml_id                => 'steering-ds2',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'steering-ds2 long_desc',
			long_desc_1           => 'steering-ds2 long_desc_1',
			long_desc_2           => 'steering-ds2 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://steering-ds2.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'steering-ds2-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	new_steering => {
		new   => 'Deliveryservice',
		using => {
			id                    => 900,
			xml_id                => 'steering-ds3',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'new-steering-ds long_desc',
			long_desc_1           => 'new-steering-ds long_desc_1',
			long_desc_2           => 'new-steering-ds long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://new-steering-ds.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'new-steering-ds-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	target_ds1 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 1000,
			xml_id                => 'steering-target-ds1',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'target-ds1 long_desc',
			long_desc_1           => 'target-ds1 long_desc_1',
			long_desc_2           => 'target-ds1 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://target-ds1.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'target-ds1-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	target_ds2 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 1100,
			xml_id                => 'steering-target-ds2',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'target-ds2 long_desc',
			long_desc_1           => 'target-ds2 long_desc_1',
			long_desc_2           => 'target-ds2 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://target-ds2.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'target-ds2-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	target_ds3 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 1200,
			xml_id                => 'steering-target-ds3',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'target-ds3 long_desc',
			long_desc_1           => 'target-ds3 long_desc_1',
			long_desc_2           => 'target-ds3 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://target-ds3.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'target-ds3-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	target_ds4 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 1300,
			xml_id                => 'steering-target-ds4',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => 'hokeypokey',
			dns_bypass_ttl        => 10,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'target-ds4 long_desc',
			long_desc_1           => 'target-ds4 long_desc_1',
			long_desc_2           => 'target-ds4 long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://target-ds4.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'target-ds4-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_cdn1_root => {
		new   => 'Deliveryservice',
		using => {
			id                    => 2100,
			xml_id                => 'test-ds1-root',
			active                => 1,
			tenant_id             => 10**9,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'test-ds1-root long_desc',
			long_desc_1           => 'test-ds1-root long_desc_1',
			long_desc_2           => 'test-ds1-root long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://test-ds1-root.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'test-ds1-root-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			logs_enabled          => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	ds_period1 => {
		new   => 'Deliveryservice',
		using => {
			id                    => 2200,
			xml_id                => 'xxfoo.bar',
			active                => 1,
			tenant_id             => undef,
			dscp                  => 40,
			deep_caching_type     => 'NEVER',
			routing_name          => 'foo',
			qstring_ignore        => 0,
			geo_limit             => 0,
			http_bypass_fqdn      => '',
			dns_bypass_ip         => '',
			dns_bypass_ip6        => '',
			dns_bypass_ttl        => -1,
			ccr_dns_ttl           => 3600,
			global_max_mbps       => 0,
			global_max_tps        => 0,
			fq_pacing_rate        => 0,			
			long_desc             => 'foo.bar long_desc',
			long_desc_1           => 'foo.bar long_desc_1',
			long_desc_2           => 'foo.bar long_desc_2',
			max_dns_answers       => 0,
			protocol              => 0,
			info_url              => 'http://foo.bar.edge/info_url.html',
			miss_lat              => '41.881944',
			miss_long             => '-87.627778',
			check_path            => '/crossdomain.xml',
			type                  => 21,
			profile               => 100,
			cdn_id                => 100,
			ipv6_routing_enabled  => 1,
			protocol              => 1,
			display_name          => 'foo.bar-displayname',
			initial_dispersion    => 1,
			regional_geo_blocking => 1,
			logs_enabled          => 1,
			anonymous_blocking_enabled => 0,
		},
	},
	
);

sub get_definition {
	my ( $self, $name ) = @_;
	return $definition_for{$name};
}

sub all_fixture_names {
	# sort by db xml_id to guarantee insertion order
	return (sort { $definition_for{$a}{using}{id} cmp $definition_for{$b}{using}{id} } keys %definition_for);
}

__PACKAGE__->meta->make_immutable;

1;
